import React from 'react'

export default function index(props) {
  // const list=[6,6,6,6,6]

  const center = props.todos.length
  const doneconte = props.todos.reduce((pre, cuttent) => { return pre + (cuttent.done ? 1 : 0) }, 0)
  console.log(props.todos.length)
  const footeralltodo = (e) => {
    console.log(e.target.checked);
    props.alltodoAPP(e.target.checked)

  }
  const allDle = () => {
    props.alltodoDelAPP()
  }

  return (
    <div>
      <input type="checkbox" name="" id="" checked={center == doneconte && center !== 0 ? true : false} onChange={footeralltodo} />
      已完成{doneconte}/全部{center}
      <button onClick={allDle}>清除完成任务</button>
    </div>
  )
}

